<template>
	<view>
		<video-detail :resourceMsg="resourceMsg" v-if="resourceType === '视频'"></video-detail>
		<pdf-detail :resourceMsg="resourceMsg" v-if="resourceType === '课件'"></pdf-detail>
		<u-parse v-if="resourceType === '专栏'" :html="resourceMsg.fileInfos[0].content"></u-parse>
	</view>
</template>

<script>
	import videoDetail from './video-detail.vue'
	import pdfDetail from './pdf-detail.vue'
	import { resourceDetail } from '@/API/index.js'
	export default {
		components:{
			videoDetail,
			pdfDetail
		},
		onLoad({id,type}) {
			console.log(id,type)
			this.getResourceDetail(id,type)
		},
		data() {
			return {
				resourceMsg:'',
				resourceType:''
			}
		},
		mounted() {
		},
		methods: {
			getResourceDetail(id,type){
				resourceDetail(id,type).then(res =>{
					console.log(res)
					this.resourceMsg = res.data
					this.resourceType = res.data.type
				})
			}
		}
	}
</script>

<style>

</style>
